home *** CD-ROM | disk | FTP | other *** search
- @echo off
- cls
- rem ******************************************************
- rem * *
- rem * BBS.BAT file for 3 Node BBS under DesQView. *
- rem * Nodes 1 & 2 run the Front Door Mailer to answer *
- rem * the phone. 3rd runs in LOCAL mode. *
- rem * All three nodes access IMail for echo/netmail *
- rem * tossing and scanning. *
- rem * *
- rem ******************************************************
-
- rem ******************************************************
- rem * set port variable dependent on each node *
- rem ******************************************************
- if %node% == N1 set port=1
- if %node% == N2 set port=2
- if %node% == N3 set port=0
- echo Selected Port is %port%.
-
- rem ******************************************************
- rem * set up variables for each node. *NOTE* FD must *
- rem * have a seperate system directory for each node. *
- rem ******************************************************
- set fd=c:\fd\%node%
- set ra=c:\ra
- set raovr=c:\ra
- set imail=c:\imail
-
- rem ******************************************************
- rem * load BNU for each node. once loaded, it doesn't *
- rem * take any more memory to run. *
- rem ******************************************************
- bnu /t=2048 /f
-
- rem ******************************************************
- rem * All this mess loops back to here each time. *
- rem * make sure we are on the correct drive and go to *
- rem * the correct directory for each node. Then run the *
- rem * correct FD for each node. Each FD has a different *
- rem * setup and control files! *
- rem * *NOTE* We are NOT running in Shell to Mailer mode! *
- rem ******************************************************
-
- :start
- rem ******************************************************
- rem * make sure the lockout files are NOT there incase *
- rem * of a system error or failure! *
- rem ******************************************************
- echo Removing old %node% lockout files.
- if exist c:\ra\%node%*.txt del c:\ra\%node%*.txt
-
- echo The Spirit of Support -=FBBS=- Node %node% is going back online!
- c:
- cd\ra\%node%
-
- rem ******************************************************
- rem * if we are node 3 goto local logon only! *
- rem ******************************************************
- if %node% == N3 goto ralocal
-
-
- c:\fd\%node%\fd.exe
-
- rem ******************************************************
- rem * check errorlevels from FD. if call is human, set *
- rem * correct baud rate before loading RA. *
- rem ******************************************************
- if errorlevel 240 set baud=2400
- if errorlevel 240 goto racall
- if errorlevel 120 set baud=1200
- if errorlevel 120 goto racall
- if errorlevel 110 set baud=300
- if errorlevel 110 goto racall
- if errorlevel 101 goto outbound
- if errorlevel 100 goto inbound
- if errorlevel 40 goto ralocal
- if errorlevel 34 goto roboevent
- if errorlevel 33 goto nightly
- if errorlevel 32 goto endok
- if errorlevel 31 goto weekly
- if errorlevel 10 goto endok
- if errorlevel 1 goto enderror
-
- rem ******************************************************
- rem * check to see if the other node is tossing inbound *
- rem * mail. if so let the caller know and exit. otherwise*
- rem * create utility lockout file for individual nodes *
- rem * as they come online for a human caller and load *
- rem * RA with environment variables set for each node. *
- rem ******************************************************
- :racall
- cls
- echo We have a caller!
- if exist c:\ra\N?toss.txt goto fdbusy
- rem > c:\ra\%node%isup.txt
- ra -%node% -C%port% -b%baud% -e20
-
- rem ******************************************************
- rem * check errorlevels after RA exit. *
- rem ******************************************************
- if errorlevel 20 goto update
- if errorlevel 5 goto outbound
- if errorlevel 4 goto outbound
- if errorlevel 3 goto outbound
- IF errorlevel 1 goto enderror
- if errorlevel 0 goto endok
-
- rem ******************************************************
- rem * we have inbound mail! take node 1's phone off hook *
- rem * and make sure node 2 is not online before tossing. *
- rem * if node 2 IS online, create a mailwaiting file so *
- rem * the waiting mail can be processed as soon as node *
- rem * is finished. in this case, we will let node 2 run *
- rem * the tosser otherwise node 1 will always toss. *
- rem * this is so that node 1 can be ready to accept *
- rem * human callers as soon as possible. *
- rem ******************************************************
-
- :inbound
- cls
- echo We have inbound mail!
- if exist c:\ra\N?toss.txt goto innodechk
- if exist c:\ra\N3outchk.txt goto 3upin
- if exist c:\ra\N1outchk.txt goto 2upin
- if exist c:\ra\N2outchk.txt goto 1upin
- if %node% == N1 goto downthisnode
- if %node% == N2 goto downthisnode
- if %node% == N3 goto 3upin
-
- rem ******************************************************
- rem * if we have just recieved a mail packet while we *
- rem * are already tossing one, we will wait till next *
- rem * time to toss it, so don't worry about it right now *
- rem ******************************************************
-
- :innodechk
- if %node% == N1 goto start
- if %node% == N2 goto start
- if %node% == N3 del c:\ra\%node%*.txt
- If %node% == N3 goto end
-
- rem ******************************************************
- rem * take node offhook *
- rem ******************************************************
-
- :downthisnode
- dtr com%port%: on
- at com%port%: h1
- rem dtr com%port%: off
- if %node% == N1 goto 2upin
- if %node% == N2 goto 1upin
-
- rem ******************************************************
- rem * check for node 1 and node 2 online *
- rem * if so, create waiting mail file. *
- rem ******************************************************
-
- :3upin
- if exist c:\ra\N1isup.txt goto 3upin1
- if exist c:\ra\N2isup.txt goto 3upin1
-
- rem ******************************************************
- rem * otherwise toss the mail! *
- rem ******************************************************
-
- goto tossit
-
- rem ******************************************************
- rem * create mail file and loop back to start *
- rem ******************************************************
-
- :3upin1
- rem > c:\ra\mail!.txt
- if exist c:\ra\%node%*.txt del c:\ra\%node%*.txt
- goto end
-
- rem ******************************************************
- rem * check for node 2 and node 3 online *
- rem * if so, create waiting mail file. *
- rem ******************************************************
-
- :2upin
- if exist c:\ra\N2isup.txt goto 2upin1
- if exist c:\ra\N3isup.txt goto 2upin1
-
- rem ******************************************************
- rem * otherwise toss the mail! *
- rem ******************************************************
-
- goto tossit
-
- rem ******************************************************
- rem * create mail file and loop back to start *
- rem ******************************************************
-
- :2upin1
- rem > c:\ra\mail!.txt
- goto start
-
- rem ******************************************************
- rem * check for node 1 and node 3 online *
- rem * if so, create waiting mail file. *
- rem ******************************************************
-
- :1upin
- if exist c:\ra\N1isup.txt goto 1upin1
- if exist c:\ra\N3isup.txt goto 1upin1
-
- rem ******************************************************
- rem * otherwise toss the mail! *
- rem ******************************************************
-
- goto tossit
-
- rem ******************************************************
- rem * create mail file and loop back to start *
- rem ******************************************************
-
- :1upin1
- rem > c:\ra\mail!.txt
- goto start
-
- rem ******************************************************
- rem * do the tossing and kill the mail waiting flag file *
- rem * also, notify both FD nodes to rescan their message *
- rem * image in memory. *
- rem ******************************************************
-
- :tossit
- rem > c:\ra\%node%toss.txt
- echo >> c:\fd\im.log
- echo Node %node% tossed this mail bundle. >> c:\fd\im.log
- imail toss
- cls
- imthings import
- rem > c:\fd\n1\fdrescan.now
- rem > c:\fd\n2\fdrescan.now
- cls
- ramsg -pkra
- if exist c:\ra\mail!.txt del c:\ra\mail!.txt
- if exist c:\ra\N?toss.txt del c:\ra\N?toss.txt
- if exist c:\ra\%node%outchk.txt goto backfromtoss
- if %node% == N3 goto N3exit
- goto start
-
- rem ******************************************************
- rem * one of the nodes is comming online in local mode. *
- rem * make the nodeisup file to let the other one know *
- rem * what is going on and load RA with the node number *
- rem * in local mode. *
- rem ******************************************************
-
- :ralocal
- if %node% == N1 goto tosschk1l
- if %node% == N2 goto tosschk2l
- if %node% == N3 goto tosschk3l
- :tosschk1l
- if exist c:\ra\N2toss.txt goto fdbusyl
- if exist c:\ra\N3toss.txt goto fdbusyl
- :tosschk2l
- if exist c:\ra\N1toss.txt goto fdbusyl
- if exist c:\ra\N3toss.txt goto fdbusyl
- :tosschk3l
- if exist c:\ra\N1toss.txt goto fdbusyl
- if exist c:\ra\N2toss.txt goto fdbusyl
- rem > c:\ra\%node%isup.txt
- set oldport=%port%
- set port=0
- ra -%node% -l -e20
- set port=%oldport%
-
- rem ******************************************************
- rem * check errorlevels on local mode exit and execute. *
- rem ******************************************************
-
- if errorlevel 20 goto update
- if errorlevel 5 goto outbound
- if errorlevel 4 goto outbound
- if errorlevel 3 goto outbound
-
- rem ******************************************************
- rem * local fdbusy display *
- rem ******************************************************
-
- :fdbusyl
- type c:\ra\fdbusy.txt
- dvcomand wait 40
- goto start
-
- rem ******************************************************
- rem * normal fdbusy display *
- rem ******************************************************
-
- :fdbusy
- echo Notifying user of System Maintainence in progress.
- type c:\ra\fdbusy.txt > com%port%:
-
- rem dtr com%port%: on
- rem at com%port%: h
- dtr com%port%: off
- dtr com%port%: on
- at com%port%: h1
- rem dtr com%port% off
- goto start
-
- rem ******************************************************
- rem * ok, now we can do the outbound stuff *
- rem * first check to see which node we are. then see if *
- rem * we have any inbound waiting to be tossed. *
- rem ******************************************************
-
- :outbound
- if %node% == N1 goto downnode
- if %node% == N2 goto downnode
- if %node% == N3 goto 3upout
-
- rem ******************************************************
- rem * take node offhook *
- rem ******************************************************
-
- :downnode
- dtr com%port%: on
- at com%port%: h1
- rem dtr com%port%: off
- if %node% == N1 goto 2upout
- if %node% == N1 goto 1upout
-
- rem ******************************************************
- rem * check to see if we have inbound waiting. *
- rem * if so, let's try to toss it before we scan *
- rem * outbound, otherwise, let's do the real thing. *
- rem ******************************************************
-
- :3upout
- :2upout
- :1upout
- if not exist c:\ra\mail!.txt goto jump
- rem > c:\ra\%node%outchk.txt
- goto inbound
- :jump
-
- rem ******************************************************
- rem * we return here if we had to toss inbound before we *
- rem * scan for outbound. *
- rem ******************************************************
-
- :backfromtoss
- if exist c:\ra\%node%outchk.txt del c:\ra\%node%outchk.txt
- if %node% == N1 goto 1echoloop
- if %node% == N2 goto 2echoloop
- if %node% == N3 goto 3echoloop
- :1echoloop
- if not exist c:\ra\N2isup.txt goto chk3
- goto start
- :2echoloop
- if not exist c:\ra\N1isup.txt goto chk3
- goto start
- :3echoloop
- if not exist c:\ra\N1isup.txt goto chk2
- if exist c:\ra\%node%isup.txt del c:\ra\%node%isup.txt
- goto end
- :chk2
- if not exist c:\ra\N2isup.txt goto echook
- if exist c:\ra\%node%isup.txt del c:\ra\%node%isup.txt
- goto end
- :chk3
- if not exist c:\ra\N3isup.txt goto echook
- goto start
-
- rem ******************************************************
- rem * ok, now we are ready to scan for outbound mail. *
- rem * when done, notify both FD nodes to rescan their *
- rem * message base image in memory. *
- rem ******************************************************
-
- :echook
- imail scan
- rem > c:\fd\n1\fdrescan.now
- rem > c:\fd\n2\fdrescan.now
-
- rem ******************************************************
- rem * ok. now we try to update the bulletins and such. *
- rem * we first check to see if the other node is up. if *
- rem * it is, then we let it handle everything when it *
- rem * exits. *
- rem ******************************************************
-
- :update
- if exist c:\ra\mail!.txt goto inbound
- if exist c:\ra\msgs\echomail.bbs goto outbound
- if exist c:\ra\msgs\netmail.bbs goto outbound
- if %node% == N1 goto check1
- if %node% == N2 goto check2
- if %node% == N3 goto check3
- :check3
- if not exist c:\ra\N1isup.txt goto chck2
- if exist c:\ra\%node%isup.txt del c:\ra\%node%isup.txt
- goto end
- :check2
- if not exist c:\ra\N1isup.txt goto chck3
- if exist c:\ra\%node%isup.txt del c:\ra\%node%isup.txt
- goto start
- :check1
- if not exist c:\ra\N2isup.txt goto chck3
- if exist c:\ra\%node%isup.txt del c:\ra\%node%isup.txt
- goto start
- :chck2
- if not exist c:\ra\N2isup.txt goto doupdate
- if exist c:\ra\%node%isup.txt del c:\ra\%node%isup.txt
- goto end
- :chck3
- if not exist c:\ra\N3isup.txt goto doupdate
- if exist c:\ra\%node%isup.txt del c:\ra\%node%isup.txt
- goto start
- :doupdate
- usa
- :n3exit
- del c:\ra\%node%isup.txt
- if %node% == N3 goto end
- goto start
-
- rem ******************************************************
- rem * all nightly maintenence is done by node 1. *
- rem * make sure the other node is not doing anything *
- rem * first. if it is, then wait a minute and try again. *
- rem ******************************************************
-
- :nightly
- if exist c:\ra\N1*.txt del N1*.txt
- if exist c:\ra\N2*.txt goto wait
- if exist c:\ra\N3*.txt goto wait
- if %node% == N1 dtr com1: on
- if %node% == N1 at com1: h1
- call c:\fd\runmaint.bat
- goto start
-
- rem ******************************************************
- rem * we come here to wait for the other node to go down *
- rem ******************************************************
-
- :wait
- dvcomand wait 30
- goto nightly
-
- rem ******************************************************
- rem * weekly maintenence is done by node 1. *
- rem ******************************************************
-
- :weekly
- if %node% == N1 dtr com1: on
- if %node% == N1 at com1 h1
- imthings stat
- goto start
-
- rem ******************************************************
- rem * OOPS! we have some kind of error! *
- rem ******************************************************
-
- :enderror
- cls
- echo The BBS is down with a FATAL error and the phone is off the hook!
- goto end
-
- rem ******************************************************
- rem * normal exit from any node *
- rem ******************************************************
-
- :endok
- cls
- dtr com%port%: on
- at com%port%: h1
- :endok2
- echo The BBS has been exited normally. The phone is unuseable.
-
- rem ******************************************************
- rem * make sure we kill any existing lockout files *
- rem * also, unload BNU from memory in this window. *
- rem ******************************************************
- :end
- if exist c:\ra\%node%isup.txt del c:\ra\%node%isup.txt
-